﻿var dayEventCache =
{
    paitentNames: [
        "Charles Abbey",
        "James Carter",
        "Jonathon Abbey",
        "Adam Kinkaid",
        "Alex Wickerham",
        "Avery Johnson",
        "Bob Cabot",
        "Caleb Booth",
        "Christopher Adams",
        "Culver James"
    ],
    dayEvents: {},
    getDayEvents: function (date) {
        if (!this.dayEvents[date]) {
            this.dayEvents[date] = this.generateDayEvents();
        }
        return this.dayEvents[date];
    },

    generateDayEvents: function () {
        var dayEvents = [];
//        dayEvents.push(new DayEvent(30, 90, this.paitentNames[0], ["abc", "def", "dkdk"]));
//        dayEvents.push(new DayEvent(60, 120, this.paitentNames[0]));
//        dayEvents.push(new DayEvent(90, 150, this.paitentNames[0]));
//        dayEvents.push(new DayEvent(120, 240, this.paitentNames[0]));
//        dayEvents.push(new DayEvent(120, 210, this.paitentNames[0]));
//        dayEvents.push(new DayEvent(120, 240, this.paitentNames[0]));
//        dayEvents.push(new DayEvent(210, 300, this.paitentNames[0]));
//        dayEvents.push(new DayEvent(540, 600, this.paitentNames[0]));
//        dayEvents.push(new DayEvent(555, 675, this.paitentNames[0]));
        for (var i = 0; i < 8; i++) {
            var patientIndex = Math.floor(Math.random() * 100 % this.paitentNames.length);
            var hour = Math.floor(Math.random() * 1000 % 16);
            //alert(hour);
            var minute = Math.floor(Math.random() * 10 % 6) * 15;
            var startTime = hour * 60 + minute;
            var duration = Math.floor(Math.random() * 10 % 10 + 2) * 30;
            var endTime = startTime + duration;
            var dayEvent = new DayEvent(startTime, endTime, this.paitentNames[patientIndex]);
            dayEvents.push(dayEvent);
        }
        return dayEvents;
    }
};

function DayEvent(startTime, endTime, title, detailItems) {
    this.startTime = startTime;
    this.endTime = endTime;
    this.title = title;
    this.detailItems = detailItems;
}